/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 * @Package com.dwusoft.uct.util  
 */
package com.apache.uct.util;

import com.apache.uct.common.ToolsUtil;

/**
 * description:  
 * @author dwusoft 创建时间：2015-3-10  
 * @Copyright(c)2014:北京--软件技术有限公司
 */
public class UctStringUtil {

	/**
	 * 属性值生成,符合骆驼命名
	 * @param str
	 * @return
	 */
	public static String toCamelNamed(String str) {
		if (ToolsUtil.isNull(str))
			return "";
		String names[] = str.split("_");
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < names.length; i++) {
			if (i == 0) {
				sb.append(names[i].toLowerCase());
			} else {
				sb.append(names[i].substring(0, 1).toUpperCase() + names[i].substring(1).toLowerCase());
			}
		}
		return sb.toString();
	}

	/**
	 * description:  返回用户类型
	 * @param sysEname 
	 * @param delStatus
	 */
	public static String getSysFlag(String sysEname, String delStatus) {
		if (ToolsUtil.isNull(sysEname) && ("F".equals(delStatus) || "T".equals(delStatus)))
			return "0";
		else if ("1".equals(sysEname) && ("F".equals(delStatus) || "T".equals(delStatus)))
			return "1";
		else if ("0".equals(sysEname) && ("F".equals(delStatus) || "T".equals(delStatus))) {
			return "0";
		} else
			return delStatus;
	}
}
